from models import BlogPost

from django.contrib.auth.models import User
from django import test

class BlogPostTestCase(test.TestCase):
    def setUp(self):
        self.user = User.objects.create_user('test', 'test@test.com', 'test')

        self.initial_content="Hello World! How are you today?!"
        self.reviewed_content="Thanks! Today is my day!"

        self.post = BlogPost.objects.create(author=self.user, title="Some name", content=self.initial_content)

        self.post.content = self.reviewed_content
        self.post.save()

    def testRevert(self):
        content_r1 = self.post.get_reverted_from_int(1)
        self.assertEquals(content_r1, self.initial_content)
        content_r2 = self.post.get_reverted_from_int(2)
        self.assertEquals(content_r2, self.reviewed_content)
